widget: Flip the sensitive flag even if the state doesn't change
authorRui Matos <tiagomatos@gmail.com>
Fri, 16 Dec 2011 23:46:19 +0000 (23:46 +0000)
committerRui Matos <tiagomatos@gmail.com>
Sat, 17 Dec 2011 11:48:01 +0000 (11:48 +0000)
Even if we can't change our sensitivity because the parent is insensitive we
should still flip the sensitive flag. Otherwise, with and insensitive parent,

child.set_sensitive(True)
...
parent.set_sensitive(True)

would result in child still being insensitive.

https://bugzilla.gnome.org/show_bug.cgi?id=666392

gtk/gtkwidget.c

index 7c189c4271b36bfacefd0afd1248de340cd63e6e..535da26376d1857c6607c394f3820ecbf91973c2 100644 (file)
@@ -7673,6 +7673,8 @@ gtk_widget_set_sensitive (GtkWidget *widget,
   if (priv->sensitive == sensitive)
     return;
 
+  priv->sensitive = sensitive;
+
   if (priv->parent == NULL
       || gtk_widget_is_sensitive (priv->parent))
     {
@@ -7681,15 +7683,9 @@ gtk_widget_set_sensitive (GtkWidget *widget,
       data.flags = GTK_STATE_FLAG_INSENSITIVE;
 
       if (sensitive)
-        {
-          priv->sensitive = TRUE;
-          data.operation = STATE_CHANGE_UNSET;
-        }
+        data.operation = STATE_CHANGE_UNSET;
       else
-        {
-          priv->sensitive = FALSE;
-          data.operation = STATE_CHANGE_SET;
-        }
+        data.operation = STATE_CHANGE_SET;
 
       data.use_forall = TRUE;